home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / utility / utilwb / mrjquote.lha / mrjQuote2.30 / ARexx / IndentAddSig.ged < prev    next >
Text File  |  1996-09-27  |  5KB  |  101 lines

  1. /* GoldEd / mrjQuote email/news indenter and signature appender
  2.    ©1996 Mark Rigby-Jones for mrjsw
  3.    mark.rigby-jones@keble.oxford.ac.uk <*> http://users.ox.ac.uk/~kebl0206/
  4.  
  5. $VER: IndentAddSig.ged 1.4 (27.09.96)
  6.  
  7.    This script is intende for use when editing emails/news articles with
  8.    GoldEd. It will add an indent ("> " by default) to every non-empty line
  9.    from the cursor position downward. It will then use mrjQuote to generate
  10.    a random signature and append this to the buffer, together with the dashes
  11.    "-- " and a little extra space.
  12.    Configuration:
  13.     Set QuotePort to the name of mrjQuote's ARexx port, and FileName and
  14.     SigName to the correct paths. Change DoSig from "load" to "yes" if you do
  15.     not want mrjQuote to be loaded if it isn't already (a new signature will
  16.     not be created in this case)
  17.    Usage:
  18.     Put this script in GOLDED:ARexx/ and create a button, menu or whatever in
  19.     GoldEd with type arexx and one of the following commands:
  20.     "GOLDED:ARexx/IndentAddSig"          - indent text and add signature
  21.     "GOLDED:ARexx/IndentAddSig NOINDENT" - add signature only
  22.     "GOLDED:ARexx/IndentAddSig NOSIG"    - indent text only                 */
  23.  
  24. QuotePort = "QUOTE"                            /* Change this if neccessary */
  25. FileName  = "mrjsw:Quote"                      /* Full path to mrjQuote     */
  26. SigName   = "Home:.signature"                  /* Full path to signature    */
  27. Indent    = "> "                               /* What to use as an indent  */
  28. DoSig     = "load"                             /* Default signature mode    */
  29.  
  30. Arg Opt .                                      /* Parse any argument        */
  31. If Opt = "NOINDENT" Then                       /* Indenting disabled        */
  32.     Indent=""
  33. If Opt = "NOSIG" Then                          /* Signature disabled        */
  34.     DoSig="no"
  35.  
  36. Options Results                                /* Enable return codes       */
  37.  
  38. If (Left(Address(),6) ~= "GOLDED") Then
  39.     Address "GOLDED.1"
  40. GoldEdPort = Address()                         /* Get GoldEd's port name    */
  41.  
  42. 'LOCK CURRENT RELEASE=4'                       /* Lock GUI, gain access     */
  43. If (RC ~= 0) Then
  44.     Exit
  45.  
  46. Options FailAt 6                               /* Ignore warnings           */
  47. Signal On Syntax                               /* Ensure clean exit         */
  48.  
  49. 'QUERY LINES VAR LINES'                        /* Get number of lines       */
  50. 'QUERY LINE VAR LINE'                          /* Get current line          */
  51. FIRST                                          /* Move to start of line     */
  52.  
  53. Do i = LINE To LINES                           /* Until end of file         */
  54.     'QUERY LEN VAR LEN'                        /*  get info about line      */
  55.     If LEN>1                                   /*  if line is non-blank     */
  56.         Then 'TEXT T "'Indent'" STAY'          /*   add Indent to start     */
  57.     DOWN
  58.     End                                        /*  move to next line        */
  59.  
  60. If DoSig = "no" Then Do                        /* If not to do  signature   */
  61.     GOTO EOL
  62.     TEXT CR                                    /*  add an extra blank line  */
  63.     UNLOCK                                     /*  unlock GoldEd            */
  64.     Exit                                       /*  and exit the script      */
  65.     End
  66.  
  67. If (~Show(P,QuotePort) & DoSig="load") Then Do /* If mrjQuote isn't loaded  */
  68.     Address "COMMAND"
  69.     'Run >NIL: "'FileName'" CDITY AREXX QUIET' /*  then run it              */
  70.     WaitForPort QuotePort                      /*  and wait for it to load  */
  71.     End
  72.  
  73. If Show(P,QuotePort) Then Do                   /* If mrjQuote is running    */
  74.     Address Value QuotePort
  75.     Sig                                        /*  create a random sig      */
  76.     Address Value GoldEdPort
  77.     End
  78.  
  79. 'OPEN NAME "'SigName'" APPEND'                 /* append signature file     */
  80.                                             
  81. DOWN
  82. TEXT CR                                        /* insert blank line         */
  83. If LINE > 1 Then                               /* " if file non-empty       */
  84.     TEXT CR
  85. If LEN > 1 Then                                /* " if line non-empty       */
  86.     TEXT CR                          
  87. TEXT T "-- " CR                                /* insert sig-break          */
  88. UP
  89. UP                                             /* move cursor back up       */
  90. UP
  91.  
  92. UNLOCK                                         /* Unlock GoldEd             */
  93. Exit
  94.  
  95. Syntax:                                        /* If there's an error       */
  96. Say "Error, line "SIGL" : "ErrorText(RC)       /*  display details          */
  97. Address Value GoldEdPort
  98. UNLOCK                                         /*  and unlock GoldEd        */
  99. Exit
  100.  
  101.